from typing import List

class Solution:
    def remove_location(self, location: str) -> tuple:
        str_list = location.split(";")
        str_dict = {}
        for item in str_list:
            if len(item) > 1 and item[0] in list('ADSW') and item[1:].isdecimal():
                str_dict[item[0]] = str_dict.get(item[0], 0) + int(item[1:])
        x, y = (str_dict['D'] - str_dict['A']), (str_dict['W'] - str_dict['S'])
        return (x, y)

    def remove_location2(self, location: List[str]) -> tuple:
        str_dict = {}
        for item in location:
            if len(item) > 1 and item[0] in list('ADSW') and item[1:].isdecimal():
                str_dict[item[0]] = str_dict.get(item[0], 0) + int(item[1:])
        x, y = (str_dict['D'] - str_dict['A']), (str_dict['W'] - str_dict['S'])
        return (x, y)


while True:
    try:
        string = input()
        str_list = string.split(";")
        str_dict = {}
        for item in str_list:
            if len(item) > 1 and item[0] in list('ADSW') and item[1:].isdecimal():
                str_dict[item[0]] = str_dict.get(item[0], 0) + int(item[1:])
        x, y = (str_dict['D'] - str_dict['A']), (str_dict['W'] - str_dict['S'])
        print("%d,%d" % (x, y))
        print(Solution().remove_location(string))
    except:
        break
        